<style>
    #center #login .field input{
        padding: 6px;
        border: 1px #ccc solid;
        background-color: #FDFDFD;
        width: 290px;
    }
    #center #login .field input:hover{
        padding: 6px;
        border: 1px #ddd solid;
        background-color: #fff;
        width: 290px;
    }

    #center #login .exit a{
        padding: 4px;
        background-color:#00A551;
        width: 150px;
        float: left;
        text-align: center;
        color: white;
        border: none;
        font-weight: bold;

        margin-top: 16px;
        margin-right: 10px;
        text-decoration: none;
    }
    #center #login .exit a:hover{
        padding: 4px;
        background-color:#007551;
        width: 150px;
        float: left;

        color: white;
        border: none;
        font-weight: bold;
        text-align: center;

        margin-top: 16px;
        margin-right: 10px;
        text-decoration: none;
    }

    #center #login .btn input{
        padding: 4px;
        background-color:orangered;
        width: 60px;
        float: right;

        color: white;
        border: none;
        font-weight: bold;

        margin-top: 16px;
        margin-right: 10px;
    }
    #center #login .btn input:hover{
        padding: 4px;
        background-color:brown;
        width: 60px;
        float: right;

        color: white;
        border: none;
        font-weight: bold;

        margin-top: 16px;
        margin-right: 10px;
    }

    #login .field{
        color: #333;
        text-align: left;

    }

    #login .label{
        margin-top: 6px;
        text-align: left;
    }

    #login{
        border: 1px #ccc solid;
        height: 150px;
        width: 300px;
        margin-left: 110px;
        padding: 20px;
        margin-top: 80px;
        margin-bottom: 80px;
        background-color: white;
        box-shadow: 4px 4px 8px #ddd,-4px -4px 8px #ddd;
    }
    #login .error{
        padding: 2px;
        color: brown;
        float: left;
        text-align: left;
    }

    .remote{
        color: #888;
        font-size: 10px;
        font-style: italic;
        padding: 2px;
    }
</style>

<script>
    function login(){
        var u = $("#username").val();
        var p = $("#password").val();
        
        var htmlold = $('#login').html();
        
        $('#login').html("<img src=\"engine/img/loader_login.gif\"></img><div>Accesso in corso...</div>");
        
        $.post('LoginServlet',{ 
            user: u, 
            password: p
        }
        , function(data) {
            if(data=='<%=session.getId()%>'){
                window.location = "?page=adm&adm="+data;
            }else{
                $('#login').html(htmlold);
                $("#response").html("Username e/o Password Errate!!!");
            }
        });
    }
</script>
<div id="center">
    <div id="login">
        <form action="javascript:login();" method="post" >
            <div class="label">User</div>
            <div class="field"><input type="text" id="username"></input></div>
            <div class="label">Password</div>
            <div class="field"><input type="password" id="password"></input></div>
            <div class="btn"><input type="submit" value="Entra"></input></div>
            <div class="exit"><a href="../?">Esci dal''aministrazione</a></div>
            <div class="error" id="response"><%
                if (request.getParameter("err") != null) {
                    out.print("Login Error!!!");
                }
                %></div>
        </form>
    </div>
</div>